import { ConfigService } from '@nestjs/config'
import { utilities, WinstonModuleAsyncOptions } from 'nest-winston'
import { format, transports } from 'winston'

export const LOGGER_OPTIONS: WinstonModuleAsyncOptions = {
  useFactory: (configService: ConfigService) => {
    return {
      transports: [
        new transports.Console({
          format: format.combine(
            format.timestamp(),
            format.ms(),
            utilities.format.nestLike('Nest', {
              colors: true,
              prettyPrint: true,
              processId: true
            })
          )
        })
      ]
    }
  },
  inject: [ConfigService]
}
